package cn.hairui.blog.dao;

import cn.hairui.blog.entity.Visitrecord;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author laoganbu
 * @since 2020-04-27
 */
@Mapper
public interface VisitrecordMapper extends BaseMapper<Visitrecord> {

    @Select("select * from visitrecord where visit_date=#{currentDate} and ip_address=#{ipAddress}")
    Visitrecord selectByVisitDateAndIpAddress(String currentDate, String ipAddress);

    @Select("select sum(visit_count) from visitrecord")
    int count();

    @Select("select sum(visit_count) from visitrecord where visit_date=#{date}")
    int countByDate(String date);
}
